<%@ page import="com.scalar.chiptrack.commons.Constants"%>
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel=stylesheet>

<Script Language="javascript">
function save()
{
    var form = document.mrbReleaseForm.lotSize;
    var count=0;
    var pa=document.getElementById("errors");
    var pa1=document.getElementById("svrErrors");
    pa1.innerHTML ='';

	// if there was only 1 transitID then previously there was a problem thus this code below
	if ( typeof form.length =='undefined')
    {
		if (document.mrbReleaseForm[ 'mrbReleaseLotsList[0].checked' ].checked == true )
        {
            count = count+1;
        }
    }
	for( var i=0; i< form.length;i++ )
	{
		if( document.mrbReleaseForm[ 'mrbReleaseLotsList[' + i + '].checked' ].checked+""=='true' )
		{
            count++;
		}
	}
	if(count==0)
	{
		var pa=document.getElementById("errors");
		pa.innerHTML = "<li> Check one or more Checkboxes to Release the Qty ";
		return;
	}
    document.mrbReleaseForm.action="<%=chipTracContext%>/mrbRelease.do?action=save";
    document.mrbReleaseForm.submit();
}

/*To reset the Values */
function reset()
{
    document.mrbReleaseForm.reset();
}


</Script>
</HEAD>
<BODY bgColor="#ffffff" leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
<html:form name="mrbReleaseForm" type="com.scalar.chiptrack.operations.dataentry.forms.MRBReleaseForm" action="/mrbRelease">
<!-- Top Header Start-->
<%@include file="/jsp/includes/header.jsp"  %>
<!-- Top Header End-->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
	<TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
        <!-- Side Navigation start -->
        <%@ include file="/jsp/operations/dataentryMenu.jsp" %>
        <!-- end of the side navigations -->
    </TD>

   <TD bgcolor="#ffffff">
        <IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8>
   </TD>
   <TD bgcolor="#ffffff">
        <IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2>
   </TD>

<TD valign="top" width="100%">

<IMG height=1 src="< %=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>


<!-- Start : In Transit Report -->

<TABLE width="100%" border="0">
    <TBODY>
    <TR>
    		<TD valign="top" bgcolor="#ffffff" >&nbsp;
				<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width="8">
            </TD>
			<TD valign="top" >
                <IMG  src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width="500" height="1" border="0">
                <!-- Start : Report Block -->
				<table valign="top" width="100%" border="0">
                    <tr><td colspan="10" width="100%" align="center"><center><span class="NArialW">MRB Release </span></center></td></tr>
                    <tr><td colspan="10" class='NArialL'><FONT id="errors" styleClass="NArialL" color="#FF0000"></FONT></td></tr>
                    <logic:equal name="showMessage" value="TRUE">
                        <TR><TD colspan='4' align='left'><font class='NArialS' color='blue'><B><%=Constants.NO_MODIFY_RIGHTS %></B></font></TD></TR>
                    </logic:equal>
                    <tr><td colspan="10" id="svrErrors">
                            <chiptrack:errors styleClass="NArialL"/>
                            <chiptrack:info styleClass="NArialL"/>
                            <chiptrack:messages type="info" styleClass="NArialL" />
                        </td>
                    </tr>
                    <bean:size id="LotsSize" name="releaseLotsList" />
                    <logic:greaterThan name="LotsSize" value="0">
					<tr>
						<td colspan="10" class='NArialL' ><font color='blue' class='NArialS' >[Click on Select checkbox to Release Qty]</font></td>
					</tr>
					<tr bgcolor="#993333" align = "center">
                        <td width="3%" class='NArialL'><font color="#FFFFFF">Select </font> </td>
						<td width="10%" nowrap class='NArialL'><font color="#FFFFFF">Part Number</font></td>
                        <td width="10%" nowrap class='NArialL'><font color="#FFFFFF">Lot No#</font></td>
                        <td width="10%" nowrap class='NArialL'><font color="#FFFFFF">Location</font></td>
                        <td width="10%" nowrap class='NArialL'><font color="#FFFFFF">Sort Date Out</font></td>
                        <td width="10%" class='NArialL'><font color="#FFFFFF">Wafer ID</font></td>
						<td width="10%" class='NArialL'><font color="#FFFFFF">Good Qty</font></td>
                        <td width="10%" class='NArialL'><font color="#FFFFFF">Comments</font></td>
                        <td width="5%"  class='NArialL'><font color="#FFFFFF">Move To</font></td>
				    </tr>
                     <nested:iterate id="mrbReleaseLotsInfo" name="mrbReleaseForm" property="mrbReleaseLotsList" indexId="iterateIdx" type="com.scalar.chiptrack.operations.dataentry.InTransitLots">
                    <% if( Integer.parseInt( iterateIdx.toString() ) % 2 == 0 ) { %>
		            <tr bgcolor='#FFFFEE'>
		            <%} else { %>
		            <tr bgcolor='#DEE1E2'>
		            <% } %>
                        <td width ="3%" align="center" class='NArialL'><nested:checkbox name="mrbReleaseLotsInfo" property="checked" /></td>
                        <td class='NArialL'><nested:write name="mrbReleaseLotsInfo" property ="partNumber"/></td>
                        <td class='NArialL'><nested:write name="mrbReleaseLotsInfo" property ="lotNumber"/></td>
                        <td class='NArialL'><nested:write name="mrbReleaseLotsInfo" property ="location"/></td>
                        <td class='NArialL'><nested:write name="mrbReleaseLotsInfo" property ="dateOut"/></td>
                        <td class='NArialL'><nested:write name="mrbReleaseLotsInfo" property ="waferId"/></td>
						<td class='NArialL'><nested:write name="mrbReleaseLotsInfo" property ="shipQty"/></td>
                        <td width="10%" class='NArialL'><nested:textarea name="mrbReleaseLotsInfo" styleClass = "txfield" property ="comments"/></td>
                        <input type="hidden" name="lotSize"  value='LotsSize'>
                        <td class='NArialL'>
                            <nested:select name="mrbReleaseLotsInfo" property="moveTo" styleClass="txfield" >
                                <html:options collection="moveToOptions"  property="value" labelProperty="label" />
                            </nested:select>
                        </td>
                    </tr>
                    </nested:iterate>
                    </table>
                    <br>
                   <center>
                   <table>
                   <tr>
                   <td >
                   <chiptrack:restrictedLink functionality='<%=Functionality.MRB_RELEASE%>' action='<%=User.USER_ACTION_MODIFY%>' href="javascript:save()" onmouseover="window.status='Click here to Release the MRB Lots';return true" onmouseout="window.status='';return true">
                   <img border="0" src="<%=chipTracContext%>/jsp/includes/images/save.gif" width="53" height="17"></chiptrack:restrictedLink>
                   </td>
                   <td>
                        <a href="javascript:reset()" onmouseover="window.status='Click here to Reset the MRB Lots';return true" onmouseout="window.status='';return true" title="Click to Reset the MRB Lots"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/reset.gif" width="53" height="17"></a>
                   </td>
            </tr>
        </logic:greaterThan>
        <logic:lessEqual name="LotsSize" value="0">
            <br><br><br><br>
                <center>
                <tr>
                    <td colspan="10" class='NArialL' align="center"><FONT  styleClass="NArialL" color="#FF0000">No Records are Found To Release MRB Lots</FONT>
                    </td>
                </tr>
                </center>
        </logic:lessEqual>
    </table>
 </center>
<!-- End : Report Block -->
<BR><BR><BR>
</TD>
</TR>
</TBODY>
</TABLE>
<!-- End : Lots Release Report -->
</html:form>
<BR><BR><BR>
</TD>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>

</TABLE>

<!-- Footer starts here -->
<%@include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->

</BODY>
</HTML>
